//转化省标数据内容
var pageii = null;
var baseURL = "../../";

Vue.use(VueVideoPlayer)
var vm = new Vue({
	
    el: '#videoapp',
    data: {
      	//message: '视频播放',
        // videojs options
        playerOptions: {
          height: '100%',
          autoplay: false,
          muted: true,
          language: 'en',
          fluid:true,
          //playbackRates: [0.7, 1.0, 1.5, 2.0],
          aspectRatio: '16:9',
          sources: [{
            type: "video/mp4",
            // mp4
            src: $("#url").val(),
          }],
          //poster: "https://surmon-china.github.io/vue-quill-editor/static/images/surmon-1.jpg",
          width: document.documentElement.clientWidth,
          notSupportedMessage: '此视频暂无法播放，请稍后再试', //允许覆盖Video.js无法播放媒体源时显示的默认信息。
          controlBar: {
        	  timeDivider: false,
        	  durationDisplay: false,
              remainingTimeDisplay: false,
              fullscreenToggle: false  //全屏按钮
          }
        }

    },
    mounted () {
//        this.getQuestionDetail();
        setTimeout(() => {
            console.log('dynamic change options', this.player)
            this.player.muted(false)
          }, 2000)
    },
    computed: {
        player() {
          return this.$refs.videoPlayer.player
        }
      },
    methods: {
    	
//    	getQuestionDetail: function() {
//
//    		let params = {
//    			questionId: $("#id").val(),
//            }
//    		let url = baseURL;
//    		url = url +'business/supervisequestion/questionDetailInfo';
//    		$.ajax({
//                type: "GET",
//                url: url,
//                data:params,
//                contentType: "application/json",
//                success: function (res) {
//                    if (res.code === '0') {
//                    	debugger;
//                        vm.questionData = res.questionList;
//                        for (let i=0; i < res.questionList.length; i++) {
//                            let imageList = res.questionList[i].imageList;
//                            let fkImageList = res.questionList[i].fkImageList;
//                            var rootPath = $("#rootPath").val();
//                            let videUrl = res.questionList[i].videoImage;
//                            if (videUrl != undefined && videUrl != null && videUrl != '') {
//                            	res.questionList[i].videoImage = rootPath + encodeURI(videUrl);
//                            }
//                            if (imageList != undefined && imageList != null && imageList != '') {
//                            	 for (let j=0; j<imageList.length; j++) {
//                                     let picUrl = imageList[j].picUrl;
//                                     imageList[j].picUrl = rootPath + encodeURI(picUrl);
//                                 }
//                            }
//                           
//                            if (fkImageList != undefined && fkImageList != null && fkImageList != '') {
//	                            for (let k=0; k<fkImageList.length; k++) {
//	                                let picUrl = fkImageList[k].picUrl;
//	                                fkImageList[k].picUrl = rootPath + encodeURI(picUrl);
//	                            }
//                            }
//                        }
//                        
//                    } else {
//                        alert(res.msg);
//                    }
//                }
//            });
//    	},
//    	
//    	//type=1 
//    	checkQuestion (type, questionId, recordId, questionModifyId, questionDescription) {
//    		//let questionId = $("#id").val();
//    		//let recordId = recordId;
//    		//let questionModifyId = questionModifyId;
//    		debugger;
//            layer.open({
//                //title : "新增执行记录",
//                type : 2,
//                fixed: true,
//                shadeClose: true,
//                area : [ "100%", "100%" ],
//                content : baseURL + '/business/supervise/questionOpen?questionId='+questionId + "&recordId=" +recordId + "&questionModifyId=" +questionModifyId + "&questionDescription=" +questionDescription + "&type=" +type
//            });
//    	},
    	
    	closeWindow: function() {
    		parent.location.reload();
    	},
    	
    	// listen event
        onPlayerPlay(player) {
          // console.log('player play!', player)
        },
        onPlayerPause(player) {
          // console.log('player pause!', player)
        },
        onPlayerEnded(player) {
          // console.log('player ended!', player)
        },
        onPlayerLoadeddata(player) {
          // console.log('player Loadeddata!', player)
        },
        onPlayerWaiting(player) {
          // console.log('player Waiting!', player)
        },
        onPlayerPlaying(player) {
          // console.log('player Playing!', player)
        },
        onPlayerTimeupdate(player) {
          // console.log('player Timeupdate!', player.currentTime())
        },
        onPlayerCanplay(player) {
          // console.log('player Canplay!', player)
        },
        onPlayerCanplaythrough(player) {
          // console.log('player Canplaythrough!', player)
        },
        // or listen state event
        playerStateChanged(playerCurrentState) {
          // console.log('player current update state', playerCurrentState)
        },
        // player is ready
        playerReadied(player) {
          // seek to 10s
          console.log('example player 1 readied', player)
          player.currentTime(10)
          // console.log('example 01: the player is readied', player)
        }
    
    }

});

